<template>
     <web-view ref="webview" :webview-styles="webviewStyles" :src="redirectUrl"></web-view>
</template>

<script>

      export default {
            data() {
                  return {
                       redirectUrl:'',
                       viewStyle:{},
                        webviewStyles: {
                              progress: {
                                    color: '#FF3333'
                              }
                        }
                  }
            },
            onLoad(e) {
                 console.log(e.redirectUrl)
                 this.redirectUrl = e.redirectUrl;
                  let _this = this;
                  uni.getSystemInfo({
                        success: (res)=> {
                              let height = res.windowHeight //获取系统信息，可使用窗口的高度
                              console.log(height)
                              _this.viewStyle.height = height;
                                  this.$nextTick(() => {
                                       setTimeout(()=>{
                                            console.log('onload')
                                            console.log(this.$refs['webview'].$el.nextSibling)
                                            console.log(this.$refs['webview'].$el.nextSibling.style.height = _this.viewStyle.height + 'px')
                                            var iframe = window.document.getElementsByTagName('iframe')[0];
                                            // 设置 iframe 的高度为 300 像素
                                            iframe.style.left = 0 + 'px';
                                            iframe.style.height = _this.viewStyle.height + 'px';
                                            iframe.style.display = 'none';
                                            setTimeout(()=>{
                                                 console.log(this.$refs['webview'].$el.nextSibling.style.height = (_this.viewStyle.height+1) + 'px')

                                            },100)
                                       },500)
                                  })
                        }
                  });


            },
      }
</script>

<style>
      iframe{
            height: 800px;
      }
</style>
